package deng.qiya.everplay;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

public class ImageActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_image);
		Intent intent = getIntent();
		Bundle bundle = intent.getExtras();
		String picInfo = bundle.getString("picInfo");
		String picId = bundle.getString("picId");
		ImageView picView =(ImageView)findViewById(R.id.picView);
		picView.setOnClickListener(listener);
		TextView message = (TextView)findViewById(R.id.messageTextView);
		picView.setImageResource(Integer.valueOf(picId));
		message.setText(picInfo);
	}
	private OnClickListener listener = new OnClickListener() {
		@Override
		public void onClick(View v) {
			Intent intent = new Intent();
			intent.putExtra("back", "back from ImageActivity");
			setResult(1,intent);
			finish();
		}
	};

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_image, menu);
		return true;
	}

}
